package com.mojo.jvm;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * Runtime类的常见方法
 *
 * @author <a href="mailto:sjj@jianzhimao.com">mojo</a>
 * copyright (C), 2013-2021, 广州九尾信息科技有限公司
 * @date 2021/8/23 15:33
 */
public class RuntimeMethod {
    public static void main(String[] args) {
        Runtime r = Runtime.getRuntime();
        long maxMemory = r.maxMemory();
        System.out.println("可使用内存" + (maxMemory / 1024 / 1024));
        long total = r.totalMemory();
        System.out.println("最大内存" + (total / 1024 / 1024));
        long free = r.freeMemory();
        System.out.println("空闲内存" + (free / 1024 / 1024));
    }

}
